<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="recomendation.persist.*" %>
<%@ page import="recomendation.impl.*" %>
<%@ page import="recomendation.*" %>
<%@ page import="java.util.ArrayList" %>

<%
    String dato = (String)request.getParameter("txtBusca");
	
	DAOImpl.actualiza(new Tag(dato,0));
	
%>
					<div id="list">
								  <ul>
								   
	                                <%
	                                	out.println(DAOImpl.llenaTagCloud());
	                                %>
								  </ul>
							  
							</div>

							<script type="text/javascript">
	
							 $(document).ready(function(){
								 var element = $('#list a');
								 var offset = 0;
								 var stepping = 0.03;
								 var list = $('#list');
								 var $list = $(list)
		
								$list.mousemove(function(e){
								    var topOfList = $list.eq(0).offset().top
								    var listHeight = $list.height()
								    stepping = (e.clientY - topOfList) /  listHeight * 0.2 - 0.1;
		   
								});
	
	
									for (var i = element.length - 1; i >= 0; i--)
									{
									    element[i].elemAngle = i * Math.PI * 2 / element.length;
									}
									//setInterval determina la velocidad de movimiento de la nube
									setInterval(render, 5);
				
									function render(){
									    for (var i = element.length - 1; i >= 0; i--){       
								        var angle = element[i].elemAngle + offset;       
								        x = 120 + Math.sin(angle) * 30;
								        y = 45 + Math.cos(angle) * 40;
								     //   size = Math.round(15- Math.sin(angle) * 15);       
									 size = 30;
								        var elementCenter = $(element[i]).width() / 2;
								        var leftValue = (($list.width()/2) * x / 100 - elementCenter) + "px"
				
								        $(element[i]).css("fontSize", size + "pt");
								        $(element[i]).css("opacity",size/100);
								        $(element[i]).css("zIndex" ,size);
								        $(element[i]).css("left" ,leftValue);
								        $(element[i]).css("top", y + "%");
								    }
				   
								    offset += stepping;
									}   
								});
	
							</script> 

